package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.LinkBean;
import com.project.mapper.ILinkMapper;
import com.project.service.ILinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class LinkServiceImpl  implements ILinkService {
    @Autowired
    private ILinkMapper mapper;
    @Override
    public void add(LinkBean linkBean) {
      mapper.add(linkBean);
    }

    @Override
    public void delId(int id) {
      mapper.delId(id);
    }

    @Override
    public void update(int id, String phone) {
     mapper.update(id,phone);
    }

    @Override
    public LinkBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public List<LinkBean> findAll() {
        return mapper.findAll();
    }

    @Override
    public PageInfo<LinkBean> cutAll(int pageNum) {
        PageHelper.startPage(pageNum,3);
        PageInfo info = PageInfo.of(mapper.cutAll(pageNum));
        return info;
    }
}
